Skip to content

Fix otelconf prometheus label escaping#8763

Merged
dmathieu merged 6 commits intoopen-telemetry:mainfrom
codeboten:fix-otelconf-prometheus-label-escaping
Apr 3, 2026
Merged

Fix otelconf prometheus label escaping#8763
dmathieu merged 6 commits intoopen-telemetry:mainfrom
codeboten:fix-otelconf-prometheus-label-escaping

Conversation

@codeboten
Copy link
Copy Markdown
Contributor

I couldn't push to the original PR #8696, this is the same as @dmitryax's original PR with the addition of a fix for 0.2.0 and applied the suggestion from @XSAM

dmitryax and others added 2 commits March 19, 2026 14:35
underscores

When both without_type_suffix and without_units are set (which is the
default config for the OTel Collector), prometheusReaderOpts was
selecting
UnderscoreEscapingWithoutSuffixes as the translation strategy. This
strategy
sets LabelNamer{UTF8Allowed: false}, converting OTel dot-style label
names
(e.g. service.name) to underscore-style (service_name) in target_info
and
on all metric datapoints.

Fix by using NoTranslation instead, which preserves dot-style label
names
(ShouldEscape()=false) and suppresses metric name suffixes
(ShouldAddSuffixes()=false).

Related issue:
open-telemetry/opentelemetry-collector-contrib#47011
Signed-off-by: alex boten <223565+codeboten@users.noreply.github.com>
@codeboten codeboten requested review from a team and pellared as code owners April 2, 2026 17:21
Comment thread CHANGELOG.md Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.5%. Comparing base (f202c3f) to head (cc964df).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8763   +/-   ##
=====================================
  Coverage   83.5%   83.5%           
=====================================
  Files        192     192           
  Lines      15578   15578           
=====================================
  Hits       13015   13015           
  Misses      2116    2116           
  Partials     447     447           
Files with missing lines Coverage Δ
otelconf/v0.2.0/metric.go 88.9% <100.0%> (ø)
otelconf/v0.3.0/metric.go 89.7% <100.0%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmathieu
Copy link
Copy Markdown
Member

dmathieu commented Apr 3, 2026

Merging this without the 24h wait, so we can get the fix into the upcoming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants